import React from 'react'
import { inject, observer } from 'mobx-react'
import { WeaLocaleProvider,WeaTop,WeaRightMenu} from 'ecCom'
import { WeaTableNew} from "comsMobx";
import * as Util from '../../util/Util';
const WeaTable = WeaTableNew.WeaTable;
const getLabel = WeaLocaleProvider.getLabel

@inject('otherRelateTastStore')
@observer
export default class OtherRelateTastList extends React.Component {

    constructor(props) {
        super(props)
        this.state = {
            rightMenu :[{key: '0',
                    icon: <i className='icon-coms-search' />,
                    content: getLabel(197,'搜索'),
                    onClick: key => this.advanceSearch(),
                }],
            _height:Util.getCurrentHeight()
        }
    }
    componentWillMount() {
        this.advanceSearch();
    }
    advanceSearch(){
        let requestids = Util.getParams("requestids");
        const {otherRelateTastStore} = this.props;
        otherRelateTastStore.getTaskList({requestids:requestids});
    }
    render() {
        const {otherRelateTastStore:{title,tableStore}} = this.props;
        const {rightMenu,_height} = this.state;
        return (
           <div style={{height:_height-50}}>
               <WeaRightMenu ecId={`${this && this.props && this.props.ecId || ''}_WeaRightMenu@1hoyvx`} datas={rightMenu}>
                 <WeaTop ecId={`${this && this.props && this.props.ecId || ''}_WeaTop@i4b5pi`} title={title?<span dangerouslySetInnerHTML={{ __html: title}}></span>:getLabel(18505,'任务列表')} icon={<i className='icon-coms-implement' />} iconBgcolor='rgb(150, 53, 138)'/>
                 <div style={{marginTop:"10px"}}><WeaTable ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@tg6kf4`} comsWeaTableStore={tableStore} hasOrder needScroll /></div>
               </WeaRightMenu>
           </div>
        )
    }
}